package com.example.cart;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Home extends Activity {
	public final static String EXTRA_MESSAGE = "com.example.cart.Category";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        final Button button1 = (Button) findViewById(R.id.cat1);
        final Button button2 = (Button) findViewById(R.id.cat2);
        button1.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				showList(1);
				
			}
        });
        button2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	showList(2);
            }
        });
        
        Button viewShoppingCart = (Button) findViewById(R.id.shoppingcart);
        viewShoppingCart.setOnClickListener(new OnClickListener() {
         
         public void onClick(View v) {
          Intent viewShoppingCartIntent = new Intent(getBaseContext(), ShoppingCartActivity.class);
          startActivity(viewShoppingCartIntent);
         }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_home, menu);
        return true;
    }
    
    public void showList(int category) {
    	Intent intent = new Intent(this, CategoryActivity.class);
    	intent.putExtra(EXTRA_MESSAGE, category);
    	startActivity(intent);
    }
    
    
}
